var form;

$(function () {
    initLayUI();
});

function initLayUI() {
    layui.use(['form'], function () {
        form = layui.form;

        form.verify({
            password: [
                /^[\S]{6,12}$/, '密码必须6到12位，且不能出现空格'
            ]
        });

        form.on('submit(resetPwdForm)', function (data) {
            let userId = getTempData('resetPwdUserId');
            ajaxUtil.simplePost({
                "userId": userId,
                "password": data.field.password
            }, "/user/resetPassword", function () {
                layerUtil.closeLayer();
                reloadParentTable('userTable');
            });
            return false;
        });

        $("#cancelBtn").click(function () {
            layerUtil.closeLayer(parent.window.iframeIndex);
        });

        form.render();
    });
}